package com.warm.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.warm.core.config.WarmConfig;
import com.warm.core.domain.AjaxResult;
import com.warm.domain.Server;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;

/**
 * 服务器监控
 *
 * @author warm
 */
@Controller
@Mapping("/monitor/server")
public class ServerController {

    @Inject
    private WarmConfig warmConfig;


    @SaCheckPermission("monitor:server:list")
    @Get
    @Mapping
    public AjaxResult getInfo() throws Exception {
        if (warmConfig.isDemoEnabled()) {
            return AjaxResult.success(null);
        }
        Server server = new Server();
        server.copyTo();
        return AjaxResult.success(server);
    }
}
